package com.xugui.learn.alibaba.tools;

import org.springframework.ai.chat.model.ToolContext;
import org.springframework.ai.tool.annotation.ToolParam;

import java.util.function.BiFunction;

/**
 * 天气查询工具
 */
public class WeatherForLocationTool implements BiFunction<String, ToolContext, String> {
    /**
     * 天气查询逻辑
     *
     * @param city       城市名称
     * @param toolContext 工具上下文
     * @return 天气信息
     */
    @Override
    public String apply(
            @ToolParam(description = "The city name") String city,
            ToolContext toolContext) {
        return "It's always sunny in " + city + "!";
    }
}